/*
   Reverse a doubly linked list, input list may also be empty
   Node is defined as
   struct Node
   {
     int data;
     Node *next;
     Node *prev
   }
*/
Node* Reverse(Node* head)
{
    // Complete this function
    // Do not write the main method.
    if(head == NULL)
        return NULL;
    if(head->next == NULL) {
        head->prev = NULL;
        return head;
    }
    Node *pn = head->next;
    Node *rev = Reverse(pn);
    pn -> next = head;
    head->prev = pn;
    head->next = NULL;
    return rev;
}